package test.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import test.service.HelloService;

/**
 * Copyright © 2018 掌上医讯. All rights reserved.
 * 
 * @Title: LoginController.java
 * @Prject: springwebsocket
 * @Package: test.controller
 * @Description: TODO
 * @author: QuZening
 * @date: 2018年3月21日 上午11:27:19
 * @version: V1.0
 */
@Controller
public class LoginController {

	@Autowired
	private HelloService helloService;

	@RequestMapping("/login")
	public String login(Model model, @RequestParam(value = "error", required = false) String error) {

		helloService.login();

		if (error != null) {
			model.addAttribute("error", "用户名或密码错误");
		}
		return "forward:/login.html";
	}

	@RequestMapping("/index")
	public String index() {
		return "index.html";
	}
}
